//
//  KChangePasswordCommandDTO.m
//  KutulusLaw
//
//  Created by Mahmood1 on 12/18/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "KChangePasswordCommandDTO.h"
#import "KChangePasswordDAO.h"


@implementation KChangePasswordCommandDTO
@synthesize password = _password, encryptedPassword = _encryptedPassword;

- (id)initWithSessionID:(NSString *)sessionID {
    self = [self init];
    
    if (self) {
        self.sessionID = sessionID;
		self.module = kAPI_MODULE;
		self.ajaxAction = kAPI_AJAX_VALUE;
		self.action = kAPI_CHANGE_PASSWORD_ACTION;
    }
    
    return self;
}

- (void) setPassword:(NSString *)password {
	_password = [password copy];
	
	_encryptedPassword = [KChangePasswordDAO criptPassword:_password];
}

- (NSMutableDictionary *) dictionary {
	return [NSMutableDictionary dictionaryWithObjectsAndKeys:self.module, kKEY_MODULE, self.action, kKEY_ACTION, self.ajaxAction, kKEY_AJAX_ACTION, self.sessionID, kKEY_SESSION_ID, self.encryptedPassword, kKEY_PASSWORD, nil];
}

- (NSString *)JSONString {
	return [[self dictionary] JSONString];
}
@end
